﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>

    <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>

    <!-- deploy this script AFTER the maps api-->

    <script src="scripts/google-maps-3-vs-1-0.js" type="text/javascript"></script>

    <script type="text/javascript">
        function initialize() {

            // NOTE: see google-maps-3-vs-1-0.js for information regarding
            // object literal constructors used in this example...
            
            
            var g = google.maps; // get an alias

            var gc = new g.Geocoder();

            // using our extension that obviates the need to create a GeocoderRequest object
            gc.geocodeAddress("1600 pennsylvania ave nw washington dc", function(result, status) {

                // use the GeocoderResponse constructor without 'new' to 'cast' the result for code
                // completion, easing the pain of drilling into a deep object model
                var response = google.maps.GeocoderResponse(result);

                // get code completion on the GeocoderStatus constant 'enum'
                if (status != g.GeocoderStatus.OK) {
                    throw new Error("Geocoder error: " + status);
                }
                else {

                    var latlng = new g.LatLng(response[0].geometry.location.a, response[0].geometry.location.b);

                    // use the constructor to build your options with no string literals
                    var myOptions = new g.MapOptions();
                    myOptions.zoom = 16;
                    myOptions.center = latlng;
                    myOptions.mapTypeId = g.MapTypeId.ROADMAP;

                    // build the map
                    var map = new g.Map(document.getElementById("map_canvas"), myOptions);

                    // add a marker
                    var mo = new g.MarkerOptions();
                    mo.position = latlng;
                    mo.map = map;
                    mo.title = "Get to work!";
                    var marker = new g.Marker(mo);

                }
            });
        }
    </script>

</head>
<body onload="initialize()">
    <div id="map_canvas" style="width: 300px; height: 300px">
    </div>
</body>
</html>
